#include "CAdGroupDescriptor.h"


CAdGroupDescriptor::CAdGroupDescriptor(void):IDescriptorData(DESCRIPTOR_TAG_GROUP_AD)
, m_dwGroupId(0xFFFF)
, m_dwAdId(0)
, m_dwAdId2(0)
, m_dwServiceGroupId(0)
{	
	m_startTime = time (NULL);
	m_endTime = time(NULL);
}

CAdGroupDescriptor::~CAdGroupDescriptor(void)
{
}

void CAdGroupDescriptor::GetData(BYTE* buff  , int &len)
{	
	CBuffer stBuffer(buff,DESCRIPTOR_MAXLEN);
	PACK_DESCRIPTOR_BUFFER_START(stBuffer,DESCRIPTOR_TAG_GROUP_AD);

	stBuffer.Write(m_dwGroupId);
	stBuffer.Write(m_dwAdId2);
	stBuffer.Write(m_dwServiceGroupId);
	BYTE aucTime[5] = {0, };
	ConvertTimeToUTC(m_startTime, aucTime);
	stBuffer.Write(aucTime, 5);
	memset(aucTime, 0xFF, sizeof(aucTime));
	ConvertTimeToUTC(m_endTime, aucTime);
	stBuffer.Write(aucTime, 5);

	len = PACK_DESCRIPTOR_BUFFER_END(stBuffer);

}